<template>
  <ul class="bk-select-menu" ref="bk-select-menu" :style="{maxHeight: maxHeight + 'px'}">
    <slot></slot>
  </ul>
</template>
<script>
export default {
  props: {
   maxHeight: {
     type: Number,
     default: 200
   }
  },
  mounted() {
    this.$nextTick(() => {
      let selectWrapp = this.$refs['bk-select-menu'];
      selectWrapp.addEventListener('scroll', () => {
        let nScrollHeight = selectWrapp.scrollHeight;
        let nScrollTop = selectWrapp.scrollTop;
        if (nScrollTop + 200 >= nScrollHeight) {
          this.$emit('toBottom')
        }
      });
    })
  }
}

</script>
